#pragma once
#include "NFComm/NFPluginModule/NFIModule.h"

class NFIHelloWorld1
    : public NFIModule
{
public:
    typedef std::function<int(const NFGUID&, const int, const NFDataList&)> OBJECT_EVENT_FUNCTOR;
    typedef std::function<int(const int, const NFDataList&)> MODULE_EVENT_FUNCTOR;

    typedef NF_SHARE_PTR<OBJECT_EVENT_FUNCTOR> OBJECT_EVENT_FUNCTOR_PTR;//EVENT
    typedef NF_SHARE_PTR<MODULE_EVENT_FUNCTOR> MODULE_EVENT_FUNCTOR_PTR;//EVENT

    virtual NF_SHARE_PTR<NFGUID> CreateXXX() = 0;

    template<typename BaseType>
    bool AddEventCallBack(const int nEventID, BaseType* pBase, int (BaseType::*handler)(const int, const NFDataList&))
    {
        MODULE_EVENT_FUNCTOR functor = std::bind(handler, pBase, std::placeholders::_1, std::placeholders::_2);
        //MODULE_EVENT_FUNCTOR_PTR functorPtr(new MODULE_EVENT_FUNCTOR(functor));
        return AddEventCallBack(nEventID, functor);
    }
protected:
    virtual bool AddEventCallBack(const int nEventID, const MODULE_EVENT_FUNCTOR cb) = 0;
};